#include "asm.h"
#include "regdef.h"
#include "inst_test.h"

LEAF(n31_div_wu_test)
    
    addi.w s0, s0 ,1
    li  s2, 0x0
###test inst
    TEST_DIV_WU(0x4e775a80, 0xb26795ec, 0x00000000)
    TEST_DIV_WU(0x4e888700, 0xf0d84fce, 0x00000000)
    TEST_DIV_WU(0x01dea048, 0xf2c74100, 0x00000000)
    TEST_DIV_WU(0x77e68950, 0x8b0ddad0, 0x00000000)
    TEST_DIV_WU(0x72013c68, 0x48cb8680, 0x00000001)
    TEST_DIV_WU(0x7fb2e9a0, 0xc9af5700, 0x00000000)
    TEST_DIV_WU(0xd7042938, 0x018a7078, 0x0000008b)
    TEST_DIV_WU(0xbf81441b, 0x704e3f24, 0x00000001)
    TEST_DIV_WU(0xeb5994e6, 0x622f1558, 0x00000002)
    TEST_DIV_WU(0x11176c40, 0x8128af78, 0x00000000)
    TEST_DIV_WU(0x32893870, 0xab09b9c0, 0x00000000)
    TEST_DIV_WU(0x403c60c0, 0x6fe79f00, 0x00000000)
    TEST_DIV_WU(0xaf855e42, 0x314b3730, 0x00000003)
    TEST_DIV_WU(0xdaa8cd0c, 0xd8f7eb07, 0x00000001)
    TEST_DIV_WU(0x26aa8c2c, 0x2db52200, 0x00000000)
    TEST_DIV_WU(0x933824b0, 0x97422b30, 0x00000000)
    TEST_DIV_WU(0x0d527980, 0x19233f98, 0x00000000)
    TEST_DIV_WU(0xfcb1d1f0, 0x2cc89437, 0x00000005)
    TEST_DIV_WU(0xd711e228, 0xdc4d82f5, 0x00000000)
    TEST_DIV_WU(0xe3e9c400, 0x5e37e5e0, 0x00000002)
    TEST_DIV_WU(0xec9a8080, 0x21240ee0, 0x00000007)
    TEST_DIV_WU(0xb0e35480, 0x8947ed80, 0x00000001)
    TEST_DIV_WU(0x0392b91c, 0x985ef388, 0x00000000)
    TEST_DIV_WU(0x39856e38, 0xb0c0860c, 0x00000000)
    TEST_DIV_WU(0x9a86f9a7, 0x62ff4728, 0x00000001)
    TEST_DIV_WU(0x0ce5e850, 0x47adbcf0, 0x00000000)
    TEST_DIV_WU(0xf4611640, 0x5d25556e, 0x00000002)
    TEST_DIV_WU(0xb7f4a7f2, 0x2dbcce30, 0x00000004)
    TEST_DIV_WU(0xd5e74ce0, 0x7cc662f7, 0x00000001)
    TEST_DIV_WU(0x9988ceac, 0xf076e887, 0x00000000)
    TEST_DIV_WU(0x850dcbd5, 0x59d75300, 0x00000001)
    TEST_DIV_WU(0x16d37c76, 0x674dc83e, 0x00000000)
    TEST_DIV_WU(0xa9589416, 0xa35bff94, 0x00000001)
    TEST_DIV_WU(0xa1909a9f, 0xa0601410, 0x00000001)
    TEST_DIV_WU(0x21e6ad92, 0x38937558, 0x00000000)
    TEST_DIV_WU(0x34097bd4, 0x24334f00, 0x00000001)
    TEST_DIV_WU(0x00d69f51, 0x638398c6, 0x00000000)
    TEST_DIV_WU(0xce523680, 0x3aa421ac, 0x00000003)
    TEST_DIV_WU(0x06be2bd0, 0x7e0469c0, 0x00000000)
    TEST_DIV_WU(0x3c8a3ed0, 0x96ba84a4, 0x00000000)
    TEST_DIV_WU(0xcdb7e7a0, 0xf02ec50b, 0x00000000)
    TEST_DIV_WU(0x3e73f907, 0x343cb0fc, 0x00000001)
    TEST_DIV_WU(0x80c64528, 0x514002d0, 0x00000001)
    TEST_DIV_WU(0x307ff23f, 0x49cb4594, 0x00000000)
    TEST_DIV_WU(0x1a5c1b18, 0x354f3820, 0x00000000)
    TEST_DIV_WU(0x152adedb, 0x92367480, 0x00000000)
    TEST_DIV_WU(0x87c6b4d4, 0x5fe2d74f, 0x00000001)
    TEST_DIV_WU(0x0a979968, 0x95636cf8, 0x00000000)
    TEST_DIV_WU(0x9a022056, 0xba1fcd4e, 0x00000000)
    TEST_DIV_WU(0x89ed9f82, 0x6ede448c, 0x00000001)
    TEST_DIV_WU(0xe27700a0, 0x96ae437e, 0x00000001)
    TEST_DIV_WU(0xfa35607c, 0x0c845564, 0x00000013)
    TEST_DIV_WU(0xfd23f6f0, 0x679ba312, 0x00000002)
    TEST_DIV_WU(0x80ede740, 0x91669d00, 0x00000000)
    TEST_DIV_WU(0x8163addd, 0x9c11473c, 0x00000000)
    TEST_DIV_WU(0xa8ff5154, 0xb2f04618, 0x00000000)
    TEST_DIV_WU(0x7f5938cd, 0x0b297e38, 0x0000000b)
    TEST_DIV_WU(0xc024b7e4, 0x8cd258b8, 0x00000001)
    TEST_DIV_WU(0xe4c9469c, 0x06d92da8, 0x00000021)
    TEST_DIV_WU(0x945fdc7a, 0x2f800526, 0x00000003)
    TEST_DIV_WU(0xcfc7186c, 0x0dec23ce, 0x0000000e)
    TEST_DIV_WU(0x1c80a1b0, 0xc1ca066e, 0x00000000)
    TEST_DIV_WU(0x8c14bff0, 0xdbebf5fc, 0x00000000)
    TEST_DIV_WU(0xfbefef80, 0x101746e1, 0x0000000f)
    TEST_DIV_WU(0xfd96711e, 0xaf0fc990, 0x00000001)
    TEST_DIV_WU(0x7fb0d7f1, 0x137ff578, 0x00000006)
    TEST_DIV_WU(0x6123f8e8, 0x698d919c, 0x00000000)
    TEST_DIV_WU(0x1bc6d70c, 0x175203f8, 0x00000001)
    TEST_DIV_WU(0x49a78e40, 0xb48180ca, 0x00000000)
    TEST_DIV_WU(0x02f09920, 0x25c6fee0, 0x00000000)
    TEST_DIV_WU(0x0a15a7d4, 0x36fc8496, 0x00000000)
    TEST_DIV_WU(0xfbd91080, 0xc13d2d2a, 0x00000001)
    TEST_DIV_WU(0xd0a0b000, 0x70dedc87, 0x00000001)
    TEST_DIV_WU(0x29a5da10, 0xb87e9c40, 0x00000000)
    TEST_DIV_WU(0x60670d88, 0x2b231300, 0x00000002)
    TEST_DIV_WU(0x9e5828c2, 0x4040cf00, 0x00000002)
    TEST_DIV_WU(0x61a97c80, 0x0a2468b8, 0x00000009)
    TEST_DIV_WU(0x94e8395f, 0xe5bd280c, 0x00000000)
    TEST_DIV_WU(0x2aba4e7a, 0x482d7bc0, 0x00000000)
    TEST_DIV_WU(0x0f578130, 0x6a1d0b70, 0x00000000)
    TEST_DIV_WU(0x9e8536f4, 0x7a2feeb0, 0x00000001)
    TEST_DIV_WU(0x6b7dc118, 0x034fb77a, 0x00000020)
    TEST_DIV_WU(0xc8b2bb64, 0x1e1293c0, 0x00000006)
    TEST_DIV_WU(0x5a45b336, 0xd4fdd710, 0x00000000)
    TEST_DIV_WU(0x6a654c20, 0x8148b638, 0x00000000)
    TEST_DIV_WU(0xe7940e6c, 0x7526c3ea, 0x00000001)
    TEST_DIV_WU(0x18be7274, 0xe2792f48, 0x00000000)
    TEST_DIV_WU(0xe434cf56, 0x7ce3a860, 0x00000001)
    TEST_DIV_WU(0xfa77a0a8, 0xb9d39f88, 0x00000001)
    TEST_DIV_WU(0x50335bbb, 0x950aa144, 0x00000000)
    TEST_DIV_WU(0x63c427d6, 0xe8d25300, 0x00000000)
    TEST_DIV_WU(0x16c3484f, 0xdb114140, 0x00000000)
    TEST_DIV_WU(0x120a7000, 0xabcddb30, 0x00000000)
    TEST_DIV_WU(0x1f58c45c, 0xad2e3d9f, 0x00000000)
    TEST_DIV_WU(0x24dbaf34, 0x9aebdeca, 0x00000000)
    TEST_DIV_WU(0xa8b75800, 0x7de01766, 0x00000001)
    TEST_DIV_WU(0xbdba6308, 0xc7fa2550, 0x00000000)
    TEST_DIV_WU(0x99a3fd70, 0x67bd7960, 0x00000001)
    TEST_DIV_WU(0x6a9dcfc0, 0x43d097e7, 0x00000001)
    TEST_DIV_WU(0xc89ce2a6, 0xffeb1c50, 0x00000000)
    TEST_DIV_WU(0xf9087cc8, 0x12400558, 0x0000000d)
    TEST_DIV_WU(0x71d79ea0, 0xf9c35ddc, 0x00000000)
    TEST_DIV_WU(0xa18e9d80, 0x4e037d7c, 0x00000002)
    TEST_DIV_WU(0x9fd0aeb1, 0xf59bf246, 0x00000000)
    TEST_DIV_WU(0xd8320444, 0x716e5200, 0x00000001)
    TEST_DIV_WU(0xe484070c, 0x73d45434, 0x00000001)
    TEST_DIV_WU(0xf4d63b98, 0xb57fc508, 0x00000001)
    TEST_DIV_WU(0xe2f55044, 0xf53819b4, 0x00000000)
    TEST_DIV_WU(0x2a241bb0, 0x318e3806, 0x00000000)
    TEST_DIV_WU(0xf66b2609, 0x49346ff4, 0x00000003)
    TEST_DIV_WU(0x06927823, 0xcc065fbd, 0x00000000)
    TEST_DIV_WU(0x5aa7865c, 0x37037ada, 0x00000001)
    TEST_DIV_WU(0x9770dac0, 0xe8669633, 0x00000000)
    TEST_DIV_WU(0xa96b6404, 0x36e6cb60, 0x00000003)
    TEST_DIV_WU(0xfc71887e, 0x998680d0, 0x00000001)
    TEST_DIV_WU(0x1966d6a4, 0x647c7020, 0x00000000)
    TEST_DIV_WU(0xa8e220c4, 0xeb56ad48, 0x00000000)
    TEST_DIV_WU(0x5950b640, 0x38742cd3, 0x00000001)
    TEST_DIV_WU(0xa11a3e87, 0x5af351a0, 0x00000001)
    TEST_DIV_WU(0x63d2bd00, 0x42d0a200, 0x00000001)
    TEST_DIV_WU(0x8fe90d8e, 0xb366c608, 0x00000000)
    TEST_DIV_WU(0x0908a490, 0x59918c08, 0x00000000)
    TEST_DIV_WU(0xd30c8a6c, 0x2ae73552, 0x00000004)
    TEST_DIV_WU(0x61e924f8, 0x61bec600, 0x00000001)
    TEST_DIV_WU(0xf45f6ed8, 0x131bfc78, 0x0000000c)
    TEST_DIV_WU(0x1fbf1006, 0x64e404e0, 0x00000000)
    TEST_DIV_WU(0x70e216ac, 0xa748d3f9, 0x00000000)
    TEST_DIV_WU(0x9ca20f65, 0xb354a050, 0x00000000)
    TEST_DIV_WU(0x3aa65400, 0x472877d0, 0x00000000)
    TEST_DIV_WU(0xaa245e30, 0x3f5a2ef4, 0x00000002)
    TEST_DIV_WU(0x76e27de0, 0xbef0a908, 0x00000000)
    TEST_DIV_WU(0x8bd8dae8, 0x95a7b198, 0x00000000)
    TEST_DIV_WU(0x771fef95, 0x40f86998, 0x00000001)
    TEST_DIV_WU(0x4b881a60, 0x45aa8b18, 0x00000001)
    TEST_DIV_WU(0x30bdc4e9, 0x81168740, 0x00000000)
    TEST_DIV_WU(0x770c5798, 0x3f28fa66, 0x00000001)
    TEST_DIV_WU(0xdeb9ee04, 0x3126ea9c, 0x00000004)
    TEST_DIV_WU(0x48ae81f0, 0x5e0c351c, 0x00000000)
    TEST_DIV_WU(0x8c73948c, 0xe6c8142a, 0x00000000)
    TEST_DIV_WU(0x2d02be90, 0x3d69ba94, 0x00000000)
    TEST_DIV_WU(0x622d0eec, 0x7b68c7db, 0x00000000)
    TEST_DIV_WU(0x23aeabc0, 0xa6757640, 0x00000000)
    TEST_DIV_WU(0xa42405dc, 0x81ae85b0, 0x00000001)
    TEST_DIV_WU(0x5ffb5218, 0xe6ff1010, 0x00000000)
    TEST_DIV_WU(0x7d92100f, 0x54b4ea50, 0x00000001)
    TEST_DIV_WU(0x890efcf8, 0x44890dbe, 0x00000001)
    TEST_DIV_WU(0xa40ce6b4, 0xb0285cf8, 0x00000000)
    TEST_DIV_WU(0x2c2a9fc2, 0x2c677764, 0x00000000)
    TEST_DIV_WU(0x22387270, 0x1ffac566, 0x00000001)
    TEST_DIV_WU(0xa41f02e0, 0xba831348, 0x00000000)
    TEST_DIV_WU(0x74d4d90c, 0xf943bdf7, 0x00000000)
    TEST_DIV_WU(0x7f8f69a8, 0x101d39a2, 0x00000007)
    TEST_DIV_WU(0xf36ea730, 0x18ad84b0, 0x00000009)
    TEST_DIV_WU(0xb95efa94, 0x0f34d9c6, 0x0000000c)
    TEST_DIV_WU(0x36a2aa20, 0xad414f06, 0x00000000)
    TEST_DIV_WU(0xfad69b46, 0xd35319d4, 0x00000001)
    TEST_DIV_WU(0x3a7dca48, 0xd0269d48, 0x00000000)
    TEST_DIV_WU(0xc01fc0f0, 0x5f2bdce0, 0x00000002)
    TEST_DIV_WU(0x136c2456, 0xd2f7a520, 0x00000000)
    TEST_DIV_WU(0xea6462b8, 0x27475ad2, 0x00000005)
    TEST_DIV_WU(0x45f1cbe2, 0x187f9910, 0x00000002)
    TEST_DIV_WU(0xc33b85ca, 0x126449e8, 0x0000000a)
    TEST_DIV_WU(0x20273480, 0xf35db380, 0x00000000)
    TEST_DIV_WU(0xafa66e60, 0xeb2ac674, 0x00000000)
    TEST_DIV_WU(0xad868694, 0xd7866c44, 0x00000000)
    TEST_DIV_WU(0x702f1d39, 0xcba2eeb0, 0x00000000)
    TEST_DIV_WU(0x83f86060, 0x29370ff3, 0x00000003)
    TEST_DIV_WU(0xaf7adfb0, 0xb1424b48, 0x00000000)
    TEST_DIV_WU(0x9adb0050, 0xa09fcd00, 0x00000000)
    TEST_DIV_WU(0xf2f16e2e, 0x7573d2f8, 0x00000002)
    TEST_DIV_WU(0x99951902, 0x8a360740, 0x00000001)
    TEST_DIV_WU(0x00000000, 0xbea685ab, 0x00000000)
    TEST_DIV_WU(0x00000000, 0x207ed850, 0x00000000)
    TEST_DIV_WU(0x00000000, 0x72c14afa, 0x00000000)
    TEST_DIV_WU(0x00000000, 0xae5365c0, 0x00000000)
    TEST_DIV_WU(0x00000000, 0x9670f9f0, 0x00000000)
    TEST_DIV_WU(0x00000000, 0x8e85bf30, 0x00000000)
    TEST_DIV_WU(0x00000000, 0x11f1eca7, 0x00000000)
###detect exception
    bne s2, zero, inst_error
    nop
###score ++
    addi.w s3, s3, 1
###output (s0<<24)|s3
inst_error:  
    slli.w t1, s0, 24
    NOP4
    or t0, t1, s3 
    NOP4
    st.w t0, s1, 0
    jirl zero, ra, 0
END(n31_div_wu_test)
